package com.scalar.chiptrack.operations.shippingRequest.actionCommands;

import com.scalar.chiptrack.commons.Constants;
import com.scalar.chiptrack.actioncommands.ActionCommand;


public class ShippingRequestCommandFactory implements Constants
{
    private static ShippingRequestCommandFactory sShipRequest;

    public synchronized static ShippingRequestCommandFactory getInstance()
    {
        if ( sShipRequest == null )
        {
            sShipRequest = new ShippingRequestCommandFactory();
        }
        return sShipRequest;
    }

    private ShippingRequestCommandFactory()
    {
    }

    /**
     * Returns the ActionCommand Class that implements businnes logic for the given action
     *
     * @param action
     * @return
     */
    public static ActionCommand getActionCommand( String action )
    {
        ActionCommand command = null;

        if( ACTION_SEARCH.equalsIgnoreCase( action ) )
        {
            command = new ShippingRequestSearchCommand();
        }
        if( ACTION_NEW.equalsIgnoreCase( action ) )
        {
            command = new ShippingRequestNewCommand();
        }
        if( ACTION_CREATE.equalsIgnoreCase( action ) )
        {
            command = new ShippingRequestCreateCommand();
        }
        if( ACTION_SAVE.equalsIgnoreCase( action ) )
        {
            command = new ShippingRequestSaveCommand();
        }
        if( ACTION_CONFIRM .equalsIgnoreCase( action ) )
        {
            command = new ShippingRequestConfirmCommand();
        }
        if( ACTION_MODIFY.equalsIgnoreCase( action ) )
        {
            command = new ShippingRequestModifyCommand();
        }
        if( ACTION_VIEW.equalsIgnoreCase( action ) )
        {
            command = new ShippingRequestViewCommand();
        }
        if( ACTION_PRINTER_FRIENDLY.equalsIgnoreCase( action ) )
        {
            command = new ShippingRequestPrintViewCommand();
        }
        /*if( ACTION_APPROVED.equalsIgnoreCase( action ) )
        {
            command = new ShippingRequestApproveCommand();
        }*/
        if( ACTION_CANCEL.equalsIgnoreCase( action ) )
        {
            command = new ShippingRequestCancelCommand();
        }
        if( ACTION_CLOSE.equalsIgnoreCase( action ) )
        {
            command = new ShippingRequestCloseCommand();
        }
        if ( ACTION_EDIT.equalsIgnoreCase( action ) )
        {
            command = new ShippingRequestEditCommand();
        }
        return command;
    }
}



